/*
 * =====================================================================================
 *
 *       Filename:  utils.h
 *
 *    Description:  Common utility funtions and macros are defined here
 *
 *        Version:  0.1
 *        Created:  2015-6-11 9:44:13
 *       Revision:  0.1 - Creation
 *       Compiler:  gcc
 *
 *         Author:  FengJie<fengjie@toecsec.com>
 *        Company:  TOEC Security
 *
 * =====================================================================================
 */
#ifndef __UTILS_H
#define __UTILS_H

#include <dev/irqreg.h>
#define REG32(addr) (*((volatile unsigned int *)(addr)))

#ifndef NULL
#define NULL    ((void *)0)
#endif

#ifndef FALSE
#define FALSE   (0)
#endif

#ifndef TRUE
#define TRUE    (1)
#endif

//typedef unsigned char  BOOL;
//typedef unsigned char  BYTE;
//typedef unsigned int   WORD;
//typedef unsigned int   DWORD;
//typedef unsigned int   UINT;
//typedef unsigned long  ULONG;

#define AT91_WATCHDOG_RESTART \
    do { \
        AT91C_BASE_WDTC->WDTC_WDCR = 0xa5000001; \
    } while(0)

#define MDM_SIGNAL sig_INTERRUPT0

#ifndef BZERO
#include <string.h>
#define BZERO(dst, count) memset(dst, 0, count)
#endif  /* BZERO */

#endif/* __UTILS_H */
